Extra: Venue 7 electrics
Extra: Venue 7 electrics#
If you see a straight line, it’s interpolated missing data. Try the sliders to see detail!
import plotly.graph_objects as go
import numpy as np
import pandas as pd
df = pd.read_csv("venue-7-clampon-data.csv")
df["timestamp"] = pd.to_datetime(df['created_at'])
df = df.fillna(value=0)
phase1trace = go.Scatter(customdata=df,
y=df['field1'],
x = df['timestamp'],
mode='lines',
hoverinfo='all',
name='phase 1',
)
phase2trace = go.Scatter(customdata=df,
y=df['field2'],
x = df['timestamp'],
mode='lines',
hoverinfo='all',
name='phase 2',
)
phase3trace = go.Scatter(customdata=df,
y=df['field3'],
x = df['timestamp'],
mode='lines',
hoverinfo='all',
name='phase 3',
)
g = go.FigureWidget(data=[phase1trace,phase2trace,phase3trace])
g.layout.title = 'CurrentCost clamp-on meter readings'
g.layout.xaxis.title= 'timestamp'
g.layout.yaxis.title = "Watts"
g.layout.width = 1000
g.layout.height = 500
fig = go.Figure(g)
fig.update_layout(
hovermode='x unified',
hoverlabel=dict(
bgcolor="white",
# font_size=16,
font_family="Rockwell"
)
)
# Add range slider
fig.update_layout(
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(
label="All",
step="all"
),
dict(count=1,
label="Hour",
step="hour",
stepmode="todate"),
dict(count=1,
label="Day",
step="day",
stepmode="backward"),
dict(count=7,
label="Week",
step="day",
stepmode="backward"),
dict(count=1,
label="Year",
step="year",
stepmode="backward")
])
),
rangeslider=dict(
visible=True,
),
type="date"
)
)
# fig.update_yaxes(range=[50, 60])
# fig.update_yaxes(range = [-5, df['temperature'].max()+5])
fig.show()
# second figure
sumtrace = go.Scatter(customdata=df,
y=df['field1'] + df['field2'] + df['field3'],
x = df['timestamp'],
mode='lines',
hoverinfo='all',
name='sum of three phases',
)
g2 = go.FigureWidget(data=[sumtrace])
g2.layout.title = 'CurrentCost clamp-on meter readings - simple sum of phases'
g2.layout.xaxis.title= 'timestamp'
g2.layout.yaxis.title = "Watts"
g2.layout.width = 1000
g2.layout.height = 500
fig2 = go.Figure(g2)
fig2.update_layout(
hovermode='x unified',
hoverlabel=dict(
bgcolor="white",
# font_size=16,
font_family="Rockwell"
)
)
# Add range slider
fig2.update_layout(
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(
label="All",
step="all"
),
dict(count=1,
label="Hour",
step="hour",
stepmode="todate"),
dict(count=1,
label="Day",
step="day",
stepmode="backward"),
dict(count=7,
label="Week",
step="day",
stepmode="backward"),
dict(count=1,
label="Year",
step="year",
stepmode="backward")
])
),
rangeslider=dict(
visible=True,
),
type="date"
)
)
fig2.show()